//
//  QFHomeTitleButton.swift
//  sinaWeibo
//
//  Created by apple on 16/3/2.
//  Copyright © 2016年 Qifeng Yan. All rights reserved.
//

import UIKit

class QFHomeTitleButton: UIButton {

    init(title: String) {
        super.init(frame: CGRectZero)
        self.setTitle(title, forState: UIControlState.Normal)
        self.setTitleColor(UIColor.darkGrayColor(), forState: UIControlState.Normal)
        self.setImage(UIImage(named: "navigationbar_arrow_down"), forState: UIControlState.Normal)
        self.sizeToFit()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        // 设置文本的位置
        self.titleLabel?.frame.origin.x = 0
        
        //设置图片的x坐标
        self.imageView?.frame.origin.x = (self.titleLabel?.frame.width)! + 3
        
    }

}
